package com.jcl.recruit.attach.mapper;

import com.jcl.recruit.attach.model.UploadFileInfo;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @ClassName UploadFileMapper
 * @Description TODO
 * @Author yyliu
 * @Date 2018/10/24 13:26
 * @Version 1.0
 **/
public interface UploadFileMapper {

    @Select({
            "<script>",
            "select * from upload_file_info",
            "<where>",
            "<if test=\"null!=corpCode\">",
            "and corp_code = #{corpCode}",
            "</if >",
            "<if test=\"null!=ownerId\">",
            "and owner_id = #{ownerId}",
            "</if >",
            "<if test=\"null!=type\">",
            "and file_type = #{type}",
            "</if >",
            "</where>",
            "</script>",

    })
    List<UploadFileInfo> findList(@Param("corpCode") String corpCode,
                                  @Param("ownerId") Integer ownerId,
                                  @Param("type") String type);

    @Select({
            "select * from upload_file_info where id = #{id} "
    })
    UploadFileInfo findOne(@Param("id") String id);



    @InsertProvider(type = UploadFileProvider.class, method = "insertProvider")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int add(UploadFileInfo uploadFileInfo);
    @UpdateProvider(type = UploadFileProvider.class, method = "updateProvider")
    int update(UploadFileInfo uploadFileInfo);
}
